package Test2;

import java.sql.*;

public class JDBCS {

    public static void main(String[] args) throws ClassNotFoundException, SQLException {

//        Class.forName("com.mysql.jdbc.Driver");

        String url="jdbc:mysql://127.0.0.1:3306/db1?useSSL=false";
        String user="root";
        String password="201110";
        Connection conn = DriverManager.getConnection(url, user, password);

        String sql = "select * from student";
        Statement stmt = conn.createStatement();


        ResultSet rs = stmt.executeQuery(sql);


        while(rs.next()){

            int anInt = rs.getInt(1);

            String string = rs.getString(2);

            String string1 = rs.getString(3);

            System.out.println(anInt+" "+string+" "+string1);
        }

        rs.close();
        stmt.close();
        conn.close();

    }
}
